package com.rabbit.springrabbitmq.producer.confrim;

import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

/**
 * @Author: JohnCoding
 * @Description:
 * @date: 2020/8/7 22:17
 */
@Component
public class ConfirmCallBack implements RabbitTemplate.ConfirmCallback {
    @Override
    public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        System.out.println("-----ConfirmCallBack----");
        System.out.println("correlationData == "+ correlationData);
        System.out.println("ack ===" + ack);
        System.out.println("cause  === "+ cause);
        if(!ack){
            //异常处理
            //补偿机制
            System.out.println("异常处理");
        }
    }
}
